import server from "../utils/request.js";

/**
 * 按社区查询巡更分类
 * @param {Number} communityId - 社区ID
 * @returns Promise
 */
export function getCategoryByCommunity(communityId) {
    return server({
        url: '/patrol/category/list',
        method: 'GET',
        params: { communityId }
    })
}

/**
 * 添加巡更分类
 * @param {Object} category - 巡更分类信息
 * @returns Promise
 */
export function addCategory(category) {
    return server({
        url: '/patrol/category/add',
        method: 'POST',
        data: category
    })
}

/**
 * 更新巡更分类
 * @param {Object} category - 巡更分类信息
 * @returns Promise
 */
export function updateCategory(category) {
    return server({
        url: '/patrol/category/update',
        method: 'POST',
        data: category
    })
}

/**
 * 删除巡更分类
 * @param {Number} categoryId - 分类ID
 * @returns Promise
 */
export function deleteCategory(categoryId) {
    return server({
        url: '/patrol/category/delete',
        method: 'GET',
        params: { categoryId }
    })
}